<template>
  <section>
    <el-dialog
      :visible.sync="visible"
      :title="title"
    >
      <div
        v-loading="loading"
        :element-loading-text="text"
        element-loading-spinner="el-icon-loading"
        element-loading-background="rgba(0, 0, 0, 0.8)"
      />
      <el-table
        :data="tableData"
        style="width: 100%">
        <el-table-column
          prop="description"
          label="问题描述"
          show-overflow-tooltip
        />
        <el-table-column
          prop="stockName"
          label="配件名称"
        />
        <el-table-column
          prop="stockNum"
          label="使用数量"
        />
        <el-table-column
          prop="price"
          label="金额"
        />
      </el-table>

    </el-dialog>
  </section>
</template>

<script>
export default {
  name: "OrderItem",
  data() {
    return {
      visible: false,
      title: '',
      loading: false,
      text: '',
      tableData: [],
    }
  },
  methods: {
    show(order) {
      this.visible = true
      this.title = "订单详情"
      this.loading = true
      this.tableData = []
      this.$axios.post("/orders/item/details", order).then(resp => {
        if (resp.data.code === 200) {
          this.loading = false
          var result = resp.data.result
          for (let key = 0; key < result.length; key++) {
            this.tableData.push(result[key])
          }
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
